<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="author" content="wangbo">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 在js中{}  就是 代码块
    {
      let age = "张三"
      {
        let num = 10
        console.log(age);
      }

      {
        console.log(num);
      }
    }




    // 全局变量, 小区,健身设置
    let name = "张三"

    if (true) {
      // 在 {}内部定义的变量 局部变量,在 所定义的{} 内部生效
      // 自家的跑步级,
      let age = 10;
      console.log(name);
      console.log(age);

    }
    if (true) {
      console.log(name);
    }
    console.log(name);
    console.log(age);
  </script>
</body>

</html>